<template>
  <div>
    <a-dropdown>
      <div>
        <slot></slot>
      </div>
      <template #overlay>
        <a-menu>
          <a-menu-item v-for="(item, index) in list" :key="index" @click="handleClick(item)">
            <div class="text-12">{{ item.label }}</div>
          </a-menu-item>
        </a-menu>
      </template>
    </a-dropdown>
  </div>
</template>
<script lang="ts" setup>
import type { PropType } from 'vue'

interface IItem {
  label: string
  value: string
}

defineProps({
  list: {
    type: Array as PropType<IItem[]>,
    required: true
  }
})

const emit = defineEmits(['onClick'])
const handleClick = (item: any) => {
  emit('onClick', item)
}
</script>
